{# The Secrets and Settings pages' shared pieces, imported with context
(``writable``, ``store``): where values live, the tables by owner, and a
row's value and actions. A row may name its own Set label (``set_label``). #}
{% from "components/macros/form.html" import action %}
{% from "components/macros/layout.html" import card %}
{% from "components/macros/table.html" import data_table %}
{% macro value_cell(shown) -%}
{{ shown.text }}
{%- endmacro %}
{% macro row_actions(row) -%}
{%- if row.testable -%}
{{ action("Test", 'hx-post="' ~ row.url ~ '/test" hx-swap="none"') }}
{%- endif -%}
{%- if row.editable -%}
{{ action(row.set_label or ("Set" if row.shown.missing else "Replace"), hx_dialog(row.url), "primary" if row.shown.missing else "default") }}
{%- elif row.in_env and writable -%}
Change it in .env
{%- elif row.env_only -%}
Set it in .env
{%- endif -%}
{%- endmacro %}
{% macro backend_note(page, saved, verb) -%}
{% if writable %}{{ saved }} A value set in .env still wins.
{% elif store %}Values are managed in {{ store }}: change them there. A value set in .env still wins.
{% else %}Values come from .env and the process environment, and change when the server restarts. Add the secrets component to {{ verb }} them here instead.{% endif %}